<?php


require("printFunc.inc.php");
require("dbFunc.inc.php");
require("sessFunc.inc.php");

//session_start();
verifySession();

printHeader("Pagina Principale");
printLink();
printRootCategories();

$itemsStart=dbGetLastItems("start_ts",0,3);
$itemsEnd=dbGetLastItems("end_ts",0,3);

?>
<div id="content">

<a href="asta.php"><h3>Ultimi oggetti inseriti</h3></a>
<table>
<thead>
    <tr>
      <?if ($_SESSION['logged']){?>
      <td>Oggetto</td>
      <td>Venditore</td>
      <td>Valore</td>
      <?}
      else{?>
      <td class="tdmax">Oggetto</td>
      <?}?>
    </tr>
</thead>

<?

while($row = mysql_fetch_array($itemsStart))
{
?>
<tr>
  <td>
    <a href="asta.php?idau=<?echo $row['idA']?>" > <?echo stripslashes($row['nomeO']);?> </a>
  </td>
<?if ($_SESSION['logged']){?>
  <td>
    <a href="user.php?idus=<?echo $row['idU'];?>"> <?echo $row['usernameU'];?> </a>
  </td>
  <td>
    <?echo $row['baseA']."&euro;";?>
  </td>
<?}?>

</tr>
<?
}
?>
</table>
    <hr/>
<h3>Aste in scadenza</h3>
<table>
<thead>
    <tr>
      <?if ($_SESSION['logged']){?>
      <td>Oggetto</td>
      <td>Categoria</td>
      <td>Scadenza</td>
      <?}
      else{?>
      <td class="tdmax">Oggetto</td>
      <?}?>
    </tr>
</thead>

<?

while($row = mysql_fetch_array($itemsEnd))
{
?>
<tr>
  <td>
    <a href="asta.php?idau=<?echo $row['idA']?>" > <?echo stripslashes($row['nomeO']);?> </a>
  </td>

<?if ($_SESSION['logged']){?>
  <td>
    <a href="cat.php?idcat=<?echo $row['idC'];?>"><?echo $row['nomeC'];?></a>
  </td>
  <td>
    <?echo $row['end_tsA'];?>
  </td>
<?}?>
</tr>
<?
}
?>
</table>


</div>

<? printFooter();?>